import Vue from 'vue'
import VueRouter from 'vue-router'

import Homepage from '@/views/Homepage' //主页
import Login from "@/views/Login" //登陆
import Register from "@/views/Register"; //注册
import Techpage from "@/views/Techpage";
import Searchpage from "@/views/Searchpage";
import Paperpage from "@/views/Paperpage";
import Authorpage from "@/views/Authorpage";
import Conferencepage from "@/views/Conferencepage";
import Institutionpage from "@/views/Institutionpage";
import Userpage from "@/views/Userpage";
import Knowledgepage from "@/views/Knowledgepage";
// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
// const originalReplace = VueRouter.prototype.replace
// VueRouter.prototype.replace = function replace(location) {
//     return originalReplace.call(this, location).catch(err => err)
// }
Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'Home',
        meta: {
            title: '首页'
        },
        component: Homepage
    },
    {
        path: '/login',
        name: 'login',
        meta: {
            title: '登录'
        },
        component: Login
    },
    {
        path: '/register',
        name: 'register',
        meta: {
            title: '注册'
        },
        component: Register
    },
    {
        path: '/tech',
        name: 'tech',
        meta: {
            title: '技术点'
        },
        component: Techpage
    },
    {
        path: '/knowledge',
        name: 'knowledge',
        meta: {
            title: '知识库展示'
        },
        component: Knowledgepage
    },
    {
        path: '/search',
        name: 'search',
        meta: {
            title: '快速检索'
        },
        component: Searchpage
    },
    {
        path: '/paper',
        name: 'paper',
        meta: {
            title: '文章信息'
        },
        component: Paperpage
    },
    {
        path: '/author',
        name: 'author',
        meta: {
            title: '作者信息'
        },
        component: Authorpage
    },
    {
        path: '/from',
        name: 'from',
        meta: {
            title: '来源信息'
        },
        component: Conferencepage
    },
    {
        path: '/institution',
        name: 'institution',
        meta: {
            title: '机构信息'
        },
        component: Institutionpage
    },
    {
        path: '/user',
        name: 'user',
        meta: {
            title: '用户信息'
        },
        component: Userpage
    }
]

const router = new VueRouter({
    routes
})
export default router
